package edu.washington.vaccine.ui;

import java.util.Calendar;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import edu.washington.vaccine.R;


/*
 * Provides a form for the user to fill
 * out. Any field can be filled or left blank
 * a completely empty form will return all patients 
 * in the database
 */
public class SearchPatientActivity extends Activity {
	@SuppressWarnings("unused")
	private static final String TAG = "SearchActivity";
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.form);
//        View root = ((ViewGroup) findViewById(android.R.id.content)).getRootView();
//        root.setFocusable(true);
//        root.setFocusableInTouchMode(true);
//        root.requestFocus();
        TextView title = (TextView) findViewById(R.id.title);
        title.setText(R.string.search_patient);

        Button searchButton = (Button) findViewById(R.id.button1);
        searchButton.setText(R.string.search_patient);
        searchButton.setOnClickListener(new SendDataListener(
        		SearchPatientActivity.this, false, SearchResultsActivity.class, "results"));
        
        Calendar c = Calendar.getInstance();
        DatePicker d = (DatePicker) findViewById(R.id.birthdate);
        d.init(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE), DateLimiter.getInstance());
        
        Button clearButton = (Button) findViewById(R.id.button2);
        clearButton.setText(R.string.clear_form);
    }
    
    @Override
	public void onBackPressed() {
//		Intent i = new Intent(this, VaccineActivity.class);
//		VaccineActivity parentActivity = (VaccineActivity)getParent();
//		parentActivity.replaceContentView("home", i);
    	FirstGroup.group.back();
	}
}
